Prizm Content Connect
Breaking Changes for v10.0

This section covers the breaking changes introduced with v10.0:

Mark#getImage() return type

The method Mark#getImage() has been updated to return an object with the following properties:

This object is the same type of object that is passed to Mark#setImage. Previously, Mark#getImage() returned a string that represented only the dataUrl of the object.

If you are using the getImage method, when upgrading to PCC v10 you will need to modify your code as demonstrated below:

Example
Copy Code
// PCC v9
var dataUrl = mark.getImage();

// PCC v10 equivalent
var dataUrl = mark.getImage().dataUrl;

PCCViewer.ViewerControl Constructor

This method has been updated to not overwrite classes that are present on the HTMLElement that is passed into the constructor. A class will not be added during the constructor and removed when calling #destroy. Further, an ID is no longer required on this element.

If your code requires that any classes (present on the HTMLElement that is passed into the ViewerControl constructor) are removed, when upgrading to PCC v10 you will need to modify your code as demonstrated below:

Example
Copy Code
// PCC v9
var viewerControl = new PCCViewer.ViewerControl($htmlElement, viewerControlOptions);

// PCC v10 equivalent
$htmlElement.removeClass();
var viewerControl = new PCCViewer.ViewerControl($htmlElement, viewerControlOptions);

Promise Rejection Reasons

Promise rejection reasons in v9.x were strings that gave a human readable message. In PCC v10, we transitioned to the rejection reason being a PCCViewer.Error object. This error object has a 'message' property, which is equivalent to the string value rejection reason. This error object also has a 'code' property, which promotes programmatic interpretation of the error, and can also be used to look up a localized error message to show to an end user. For a list of the codes and localized error messages, see the "error" term in the language.json file.

If you are referencing promise rejection reasons in your code, when upgrading to PCC v10 you will need to modify your code as demonstrated below:

Example
Copy Code
// PCC v9
viewer.requestPageText(pageIndex).then(function (pageText) {
       alert('The request was successful.');
}, function(reason) {
         if (reason === "Text extraction failed.") {
                  alert('requestPageText failed because: ' + reason);
         }
});

// PCC v10 equivalent
viewer.requestPageText(pageIndex).then(function (pageText) {
       alert('The request was successful.');
}, function(reason) {
         if (reason.code === "TextExtractionFailed") {
                 alert('requestPageText failed because: ' + reason.message);
         }
});

Escaping of Selected Text

Text used to be escaped when accessed through the Mark.getText method on highlight marks or from the TextSelected event. This meant that the text was safe to insert into the DOM directly, but it also meant that it was not the actual selected text. In order to provide the API user with the actual document text, we removed all assumptions about how the text will be used and no longer return escaped text.

If you are inserting selected text into the DOM directly in your code, when upgrading to PCC v10 you will need to either escape the text or use a text node to insert it into the DOM. For example, you can use a text node as demonstrated below:

Example
Copy Code
var textNode = document.createTextNode(eventArgs.selectedText);
myElement.appendChild(textNode);

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback